com.jproxy.proxy
Class Tunnel

java.lang.Object
  |
  +--com.jproxy.proxy.Tunnel
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CallbackTunnel, ServletTunnel

public abstract class Tunnel
extends java.lang.Object
implements java.io.Serializable

Abstract class that is responsible for client-side data marshalling and client-side object distribution protocol implementation. It has helper-methods for object instantiation and getting existing instance. If stub for remote object has to be returned as result of method call then the instance of the class is created on tunneling server side, otherwise instance is created on the invoking client. The class also declares constants for Tunneling environment. Most of the constants may be used to customize tunneling for client needs.

See Also:
Serialized Form

Field Summary
static java.lang.String CALLBACK_PENDING_TIME
          A max pending time (mills) for client's polling request.
static java.lang.String CALLBACK_TUNNEL_CLASS
          A class name of asynchronous tunnel.
static java.util.Hashtable callbackTunnels
          All callback tunnels hashed by URL String of Tunneling server.
static java.lang.String COMPRESSION_ENABLED
          A flag enabling data compression during marshaling and unmarshaling.
static java.lang.String DATASTACK_ENABLED
          A flag enabling remote call optimization.
static java.util.Hashtable env
          All tunnels hashed by URL String of Tunneling server
static java.lang.Class features
           
static java.lang.String HOST_URL
          A URL String of Tunneling server
static java.lang.String INITIAL_CONTEXT_FACTORY
          The classname of InitialContectFactory of remote JNDI
static java.lang.String INVOCATION_INTERCEPTOR
           
static java.lang.String INVOCATOR_THREADING_ENABLED
           
static java.lang.String JAAS_CONFIGURATION_NAME
          A JAAS Configuration name.
static java.lang.String LOG_CLASS
          A class used as output for log information.
static java.lang.String LOG_LEVEL
          A verbosity level of loggin: one og folowing: FATAL,ERROR,WARNING,INFORMATION,DEBUG,NONE or abbreviation: F,E,W,I,D,N
static java.lang.String MAX_FAILOVER_ATTEMPTS
          A max number of failover invocation attepts
static java.lang.String NATIVE_EXCEPTIONS_ENABLED
           
static java.lang.String NETWORK_PERFORMANCE_THRESHOLD
           
static java.lang.String OBJECT_DESTROY_ENABLED
          A flag enabling automatic object destuction.
static java.lang.String OBJECT_TTL
          A time-to-live of remote object in mills
static java.lang.String PROVIDER_URL
           
static java.lang.String REMOTE_CLASSES
          A list of class names.
static java.lang.String SERVER_RESPONSE_MIN
          A minimum length of server response.
static java.lang.String SOCKET_TIMEOUT
          A socket timeout in mills.
static java.lang.String STUBGEN_CLASSPATH
          The classpath which stubgen uses to place dynamically generated proxy stubs
static java.lang.String STUBGEN_COMPILER_CLASSPATH
          A classpath used by javac compiler for dinamic stub generation
static java.lang.String STUBGEN_COMPILER_OPTIONS
          An options used by javac compiler for dinamic stub generation
static java.lang.String STUBGEN_LIB_CLASSPATH
          A classpath used by javac compiler for dinamic stub generation
static java.lang.String TUNNEL_CLASS
          A class name of synchronous tunnel.
static java.lang.String TUNNEL_URL
          A tunneling URL.
static java.util.Hashtable tunnels
          All tunnels hashed by URL String of Tunneling server.
static java.lang.String USE_JPROXY_SSL_SOCKET_FACTORY
          A flag enabling JProxy SSLProxySocketFactory.
 java.lang.String version
           
static java.lang.String VERSION
          Client-Server read-only property.
 
Constructor Summary
Tunnel()
           
 
Method Summary
static Tunnel createCallbackTunnel(CallbackServer server)
           
 Marshalable createConstructRequest(java.lang.String className, java.lang.String[] interfaceNames, java.lang.Class[] argTypes, java.lang.Object[] args)
           
 Marshalable createDestructRequest(long objectId)
           
 Marshalable createInvokeRequest(long objectId, java.lang.reflect.Method method, java.lang.Object[] args)
           
 Marshalable createReferenceRequest(long objectId)
           
 Marshalable createStubRequest(java.lang.String[] interfaceNames)
           
static Tunnel createTunnel(java.lang.String serverUrlStr)
           
abstract  CallbackClient getCallbackClient()
           
 java.lang.Object getInstance(long objectId)
          The helper method for getting existing instance of Tunneling object located on Tunneling server by given objectId
 java.lang.String getServerUrl()
           
 long getTimeout()
          The method returns communication timeout for tunnel (measured in milliseconds).
abstract  java.lang.Object invoke(java.lang.Object data)
          The method sends marshaled data and unmurshal result for remote call.
 java.lang.Object invokeMethod(long objectId, java.lang.reflect.Method method, java.lang.Object[] args)
          The helper method for invoking method on instance of Tunneling object on Tunneling server
 Marshalable invokeRequest(Marshalable data)
           
 java.lang.Object newInstance(java.lang.String className, java.lang.String[] interfaceNames, java.lang.Class[] argTypes, java.lang.Object[] args)
          The helper method for creating new instance of Tunneling object on Tunneling server
 Tunnelizable newStub(java.lang.String[] interfaceNames)
          The helper method for creating new instance of Tunneling object on Tunneling server
static boolean parseBoolean(java.lang.String stringValue)
           
 void removeInstance(Tunnelizable object)
           
 void setServerUrl(java.lang.String _serverUrlStr)
           
 void setTimeout(long _timeout)
          The method sets communication timeout for tunnel (measured in milliseconds).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

env

public static java.util.Hashtable env
All tunnels hashed by URL String of Tunneling server

features

public static java.lang.Class features

tunnels

public static java.util.Hashtable tunnels
All tunnels hashed by URL String of Tunneling server.

callbackTunnels

public static java.util.Hashtable callbackTunnels
All callback tunnels hashed by URL String of Tunneling server.

VERSION

public static final java.lang.String VERSION
Client-Server read-only property. JProxy Tunnel Version

REMOTE_CLASSES

public static final java.lang.String REMOTE_CLASSES
A list of class names. If result of remote call is instance of one of folowing classes then jproxy creates remote stub for it.

TUNNEL_CLASS

public static final java.lang.String TUNNEL_CLASS
A class name of synchronous tunnel. Default is ServletTunnel.

CALLBACK_TUNNEL_CLASS

public static final java.lang.String CALLBACK_TUNNEL_CLASS
A class name of asynchronous tunnel. Default is HttpCallbackTunnel.

LOG_LEVEL

public static final java.lang.String LOG_LEVEL
A verbosity level of loggin: one og folowing: FATAL,ERROR,WARNING,INFORMATION,DEBUG,NONE or abbreviation: F,E,W,I,D,N

LOG_CLASS

public static final java.lang.String LOG_CLASS
A class used as output for log information. It inherited from PrintStream It the property not specifyed then System.out is used.

TUNNEL_URL

public static final java.lang.String TUNNEL_URL
A tunneling URL. The context is used to construct complete URL to access servlet. Default is http://localhost/proxyservlet/servlet/proxyservlet

INVOCATION_INTERCEPTOR

public static final java.lang.String INVOCATION_INTERCEPTOR

OBJECT_TTL

public static final java.lang.String OBJECT_TTL
A time-to-live of remote object in mills

OBJECT_DESTROY_ENABLED

public static final java.lang.String OBJECT_DESTROY_ENABLED
A flag enabling automatic object destuction.

SOCKET_TIMEOUT

public static final java.lang.String SOCKET_TIMEOUT
A socket timeout in mills. 0 - infinit

CALLBACK_PENDING_TIME

public static final java.lang.String CALLBACK_PENDING_TIME
A max pending time (mills) for client's polling request. If CallbackServer does not have any callback requests then during the time client polling call will be blocked.

MAX_FAILOVER_ATTEMPTS

public static final java.lang.String MAX_FAILOVER_ATTEMPTS
A max number of failover invocation attepts

COMPRESSION_ENABLED

public static final java.lang.String COMPRESSION_ENABLED
A flag enabling data compression during marshaling and unmarshaling.

USE_JPROXY_SSL_SOCKET_FACTORY

public static final java.lang.String USE_JPROXY_SSL_SOCKET_FACTORY
A flag enabling JProxy SSLProxySocketFactory.

DATASTACK_ENABLED

public static final java.lang.String DATASTACK_ENABLED
A flag enabling remote call optimization. During this optimization, all calls that return void are sent as one request to the server.

SERVER_RESPONSE_MIN

public static final java.lang.String SERVER_RESPONSE_MIN
A minimum length of server response.

STUBGEN_CLASSPATH

public static final java.lang.String STUBGEN_CLASSPATH
The classpath which stubgen uses to place dynamically generated proxy stubs

STUBGEN_COMPILER_CLASSPATH

public static final java.lang.String STUBGEN_COMPILER_CLASSPATH
A classpath used by javac compiler for dinamic stub generation

STUBGEN_COMPILER_OPTIONS

public static final java.lang.String STUBGEN_COMPILER_OPTIONS
An options used by javac compiler for dinamic stub generation

STUBGEN_LIB_CLASSPATH

public static final java.lang.String STUBGEN_LIB_CLASSPATH
A classpath used by javac compiler for dinamic stub generation

JAAS_CONFIGURATION_NAME

public static final java.lang.String JAAS_CONFIGURATION_NAME
A JAAS Configuration name. Default value is "other". For JBoss must be "client-login".

HOST_URL

public static final java.lang.String HOST_URL
A URL String of Tunneling server

INITIAL_CONTEXT_FACTORY

public static final java.lang.String INITIAL_CONTEXT_FACTORY
The classname of InitialContectFactory of remote JNDI

PROVIDER_URL

public static final java.lang.String PROVIDER_URL

INVOCATOR_THREADING_ENABLED

public static final java.lang.String INVOCATOR_THREADING_ENABLED

NETWORK_PERFORMANCE_THRESHOLD

public static final java.lang.String NETWORK_PERFORMANCE_THRESHOLD

NATIVE_EXCEPTIONS_ENABLED

public static final java.lang.String NATIVE_EXCEPTIONS_ENABLED

version

public java.lang.String version
Constructor Detail

Tunnel

public Tunnel()
Method Detail

createCallbackTunnel

public static Tunnel createCallbackTunnel(CallbackServer server)

createTunnel

public static Tunnel createTunnel(java.lang.String serverUrlStr)

parseBoolean

public static boolean parseBoolean(java.lang.String stringValue)

invoke

public abstract java.lang.Object invoke(java.lang.Object data)
                                 throws java.lang.Throwable
The method sends marshaled data and unmurshal result for remote call. The method is executed on the client.
Parameters:
data - Data object
Throws:
TunnelException -  

getCallbackClient

public abstract CallbackClient getCallbackClient()
                                          throws java.lang.Throwable

getServerUrl

public java.lang.String getServerUrl()

setServerUrl

public void setServerUrl(java.lang.String _serverUrlStr)

createStubRequest

public Marshalable createStubRequest(java.lang.String[] interfaceNames)

createConstructRequest

public Marshalable createConstructRequest(java.lang.String className,
                                          java.lang.String[] interfaceNames,
                                          java.lang.Class[] argTypes,
                                          java.lang.Object[] args)

createInvokeRequest

public Marshalable createInvokeRequest(long objectId,
                                       java.lang.reflect.Method method,
                                       java.lang.Object[] args)

createReferenceRequest

public Marshalable createReferenceRequest(long objectId)

createDestructRequest

public Marshalable createDestructRequest(long objectId)

removeInstance

public void removeInstance(Tunnelizable object)
                    throws java.lang.Throwable

invokeRequest

public Marshalable invokeRequest(Marshalable data)
                          throws java.lang.Throwable

newStub

public Tunnelizable newStub(java.lang.String[] interfaceNames)
                     throws java.lang.Throwable
The helper method for creating new instance of Tunneling object on Tunneling server
Parameters:
className -  
interfaceName -  
args - arguments for constructor
Throws:
TunnelException -  

newInstance

public java.lang.Object newInstance(java.lang.String className,
                                    java.lang.String[] interfaceNames,
                                    java.lang.Class[] argTypes,
                                    java.lang.Object[] args)
                             throws java.lang.Throwable
The helper method for creating new instance of Tunneling object on Tunneling server
Parameters:
className -  
interfaceName -  
args - arguments for constructor
Throws:
TunnelException -  

getInstance

public java.lang.Object getInstance(long objectId)
                             throws java.lang.Throwable
The helper method for getting existing instance of Tunneling object located on Tunneling server by given objectId
Parameters:
className -  
interfaceName -  
objectId -  
Throws:
TunnelException -  

invokeMethod

public java.lang.Object invokeMethod(long objectId,
                                     java.lang.reflect.Method method,
                                     java.lang.Object[] args)
                              throws java.lang.Throwable
The helper method for invoking method on instance of Tunneling object on Tunneling server
Parameters:
objectId - of remote object
interfaceName - of remote interface
mathod - that supposed to be invoked
args - arguments for method
Throws:
TunnelException -  

getTimeout

public long getTimeout()
The method returns communication timeout for tunnel (measured in milliseconds). The timeout is maximum delay for response from remote object. The default timeout for all instances of Tunnel is set in static property SOCKET_TIMEOUT in Tunnel class and also may be changed. A timeout value can be customized by calling setTimeout(timeout).

setTimeout

public void setTimeout(long _timeout)
The method sets communication timeout for tunnel (measured in milliseconds). The timeout is maximum delay for response from remote object. The default timeout for all instances of Tunnel is set in static property TIMEOUT in Tunnel class and also may be changed. A timeout value can be obtained from setTimeout(timeout) method.
Parameters:
communication - timeout for tunnel in milliseconds


Copyright ⌐ JProxy LLC. All Rights Reserved.